package com.millstein.tsinglog.mapper.biz;

import com.millstein.tsinglog.mapper.BaseMapper;
import com.millstein.tsinglog.model.pojo.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface CategoryMapper extends BaseMapper<Category> {
    /**
     * server用，根据id查询分类
     * @param id
     * @return
     */
    @Select("SELECT `id`, `category_name` categoryName, `description`, `sort`, `usable`, `status`, " +
            "`create_time` createTime, `update_time` updateTime FROM `biz_category` " +
            "where `status` = 1 and `id` = #{id};")
    Category selectCategoryByPrimaryKeyForServer(@Param("id") Long id);

    /**
     * web用，根据id查询分类
     * @param id
     * @return
     */
    @Select("SELECT `id`, `category_name` categoryName, `description`, `sort`, `usable`, `status`, " +
            "`create_time` createTime, `update_time` updateTime FROM `biz_category` " +
            "where `usable` = 1 and `status` = 1 and `id` = #{id};")
    Category selectCategoryByPrimaryKeyForWeb(@Param("id") Long id);
}
